package com.lyk.coursearrange.common.exception;

import com.lyk.coursearrange.common.core.base.code.CodeEnum;
import lombok.Data;
import lombok.Getter;

/**
 * 自定义异常工具类
 */

@Data
/*@Slf4j*/
public class MZException extends RuntimeException {
    @Getter
    protected Integer code;

    public MZException(Integer code, String message){
        super(message);
        this.code=code;
    }

    public MZException(CodeEnum codeEnum){
        super(codeEnum.getMessage());
        this.code=codeEnum.getCode();
    }

    public MZException(String message){
        super(message);
    }

    @Override
    public String toString() {
        return "MZException{" +
                "code=" + code +
                ", message=" +this.getMessage() +
                '}';
    }
}
